package zouran.config;

import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import zouran.util.COSFileUtil;

/**
 * 用于将一些配置文件中变量加载初始化
 *
 * @author zouran
 * createDate：2024/8/8  22:06
 */
@Component
public class VariableConfig {

    public VariableConfig(Environment environment) {
        boolean used = Boolean.parseBoolean(environment.getProperty("tencent-cos.custom-domain-name.used"));
        String generalApiEndpoint = environment.getProperty("tencent-cos.custom-domain-name.general-apiEndpoint");
        String serviceApiEndpoint = environment.getProperty("tencent-cos.custom-domain-name.service-apiEndpoint");
        //初始化COS自定义域名参数
        COSFileUtil.init(used, generalApiEndpoint, serviceApiEndpoint);
    }
}
